home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / smail-3.1.28 / src / addr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-11  |  6.5 KB  |  157 lines

  1. /* @(#)src/addr.h    1.8 7/11/92 11:47:09 */
  2.  
  3. /*
  4.  *    Copyright (C) 1987, 1988 Ronald S. Karr and Landon Curt Noll
  5.  *    Copyright (C) 1992  Ronald S. Karr
  6.  *
  7.  * See the file COPYING, distributed with smail, for restriction
  8.  * and warranty information.
  9.  */
  10.  
  11. /*
  12.  * addr.h:
  13.  *    interface file for routines in addr.c
  14.  */
  15.  
  16. /* types used in addr.h */
  17. /*
  18.  * addr - Everything needed to understand an address is stored in
  19.  *      here somewhere.
  20.  */
  21. struct addr {
  22.     struct addr *succ;        /* next addr in queue */
  23.     long flags;            /* miscellaneous flags */
  24.     int parseflags;        /* parse flags for parse_address() */
  25.     struct addr *parent;    /* addr from which this one is derived */
  26.     struct addr *true_addr;    /* point to addr which had an error */
  27.     char *in_addr;        /* address from header or args */
  28.     char *target;        /* next explicit destination */
  29.     char *remainder;        /* address beyond explicit site */
  30.     char *work_addr;        /* working area */
  31.     int match_count;        /* chars of target matched by router */
  32.     char *route;        /* the route to the target */
  33.     struct router *router;    /* router used for route and next_host */
  34.     struct director *director;    /* director which matched address */
  35.     char *next_host;        /* next-hop host to receive message */
  36.     char *next_addr;        /* address to give next-hop host */
  37.     struct transport *transport; /* transport to use for remote delivery */
  38.     char *home;            /* home directory associated with login */
  39.     int uid;            /* user for pipes/files perms or BOGUS_USER */
  40.     int gid;            /* gid for pipes/files perms or BOGUS_GROUP */
  41.     struct error *error;    /* error message associated */
  42.     struct transport_hints *tphint_list; /* transport hints from the router */
  43. };
  44.  
  45. /* structure for errors stored in the addr structure */
  46. struct error {
  47.     long info;                /* info associated with error */
  48.     char *message;            /* error message */
  49. };
  50.  
  51. /*
  52.  * The identify_addr structure is used to uniquely identify specific addr
  53.  * structures produced by resolve_addr_list().  The in_addr value in an
  54.  * addr structure is insufficient, by itself, to identify an addr structure,
  55.  * when that structure is a file or pipe form address.  It is, however,
  56.  * sufficient to give the parent address as well, if one exists.
  57.  */
  58. struct identify_addr {
  59.     struct identify_addr *succ;        /* this will be a linked list */
  60.     char *address;            /* the address of interest */
  61.     char *parent;            /* the parent of that address */
  62. };
  63.  
  64. /*
  65.  * The defer_addr structure is used to form a list of previously defer'd
  66.  * addresses.  This list is formed from the per-message logfile data, and
  67.  * is used to filter out redundant deferal messages.
  68.  */
  69. struct defer_addr {
  70.     struct defer_addr *succ;        /* this will be a linked list */
  71.     long error;                /* error number */
  72.     char *message;            /* deferal message */
  73.     char *address;            /* address defered */
  74.     char *parent;            /* parent of defered address */
  75. };
  76.  
  77. /*
  78.  * The transport_hints structure can be used to pass additional
  79.  * routing information between a router and a transport.  It is
  80.  * organized as a linked list of tagged values, where the tags
  81.  * describe the type of hint.  The bind router, for example, passes an
  82.  * "mx" type transport hint for each possible SMTP mail exchanger to
  83.  * the tcpsmtp transport.
  84.  */
  85. struct transport_hints {
  86.     struct transport_hints * succ;    /* pointer to next hint */
  87.     char * hint_name;        /* type of information */
  88.     char * private;            /* pointer to information */
  89. };
  90.  
  91. /*
  92.  * bits used in addr.flag
  93.  */
  94. #define ADDR_CAUTION    0x00000010    /* be cautious of this address */
  95. #define ADDR_UNSECURE    0x00000200    /* address from an unsecure source */
  96. #define ADDR_PUTDOT    0x00000400    /* dot removed from end of target */
  97. #define ADDR_MOVEDOT    0x00000800    /* end dot moved to front of target */
  98. #define ADDR_ERROR    0x00001000    /* error in resolving address */
  99. #define ADDR_FINISHED    0x00002000    /* address fully resolved */
  100. #define ADDR_FULLMATCH    0x00004000    /* router fully matched target */
  101. #define ADDR_DONTHASH    0x00008000    /* addr states should not be hashed */
  102. #define ADDR_SMARTUSER    0x00010000    /* smart user director already used */
  103. #define ADDR_SMARTHOST    0x00020000    /* smart host router already used */
  104. #define ADDR_NOTUSER    0x00040000    /* address is not a local user */
  105. #define ADDR_ISUSER    0x00080000    /* address is a local user */
  106. #define ADDR_FWDTYPE    0x00100000    /* director used was forwarding type */
  107. #define ADDR_ALIASTYPE    0x00200000    /* director used was aliasing type */
  108. #define ADDR_LISTTYPE    0x00400000    /* director was mailinglist type */
  109. #define ADDR_SHADOW    0x00800000    /* using shadow transport */
  110. #define ADDR_PARTLOCAL    0x01000000    /* partially matched local host */
  111. #define ADDR_RETRY_FILE    0x02000000    /* on failure, touch retry file */
  112. #define ADDR_FORM_MASK    0x0000000f    /* form from parse_address */
  113. /*
  114.  * NOTE:
  115.  *    Routers can set ADDR_SMARTHOST if the smarthost router should
  116.  *    not be used.  For example, if the local host is a gateway for
  117.  *    a domain and a hostname within that domain cannot be resolved,
  118.  *    then the router can set ADDR_SMARTHOST to prevent an incorrect
  119.  *    usage of the smarthost router.
  120.  *    Directors can set ADDR_SMARTUSER in a similar manner if this
  121.  *    ever proves useful.
  122.  *
  123.  * The ADDR_PARTLOCAL should also be set for partial matches to the local
  124.  * host.  If ADDR_PARTLOCAL is set for an address and ADDR_FULLMATCH
  125.  * is not set, the target is not considered to be resolved.
  126.  */
  127.  
  128. /* bits stored in error.info */
  129. #define ERR_MASK    0x0000ffffL    /* mask for the error number */
  130. #define ERR_NSENDER    0x00010000L    /* notify sender of message */
  131. #define ERR_NPOSTMAST    0x00020000L    /* notify postmaster */
  132. #define ERR_NSOWNER    0x00040000L    /* notify address owner or sender */
  133. #define ERR_NPOWNER    0x00080000L    /* notify owner or postmaster */
  134. #define ERR_CONFERR    0x00100000L    /* configuration error encountered */
  135. #define ERR_DONTLOG    0x00200000L    /* don't log this error */
  136.  
  137. /*
  138.  * user and group ids are preset to BOGUS_USER and BOGUS_GROUP in order
  139.  * to prevent them from being mistaken for root and wheel
  140.  */
  141. #define BOGUS_USER (-1)            /* not a valid user id */
  142. #define BOGUS_GROUP (-1)        /* not a valid group id */
  143.  
  144. /* return values from parse_address */
  145. #define PARSE_ERROR    0        /* error in parsing */
  146. #define RFC_ROUTE    1        /* route part of a route-addr */
  147. #define RFC_ENDROUTE    2        /* last component of a route */
  148. #define MAILBOX        3        /* standard user@foo mailbox */
  149. #define UUCP_ROUTE    4        /* uucp !-route */
  150. #define PCT_MAILBOX    5        /* non-standard user%foo mailbox */
  151. #define LOCAL        6        /* local address */
  152. #define BERKENET    7        /* berkenet host:user form */
  153. #define DECNET        8        /* decnet host::user form */
  154.  
  155. /* flag values for the parse_address flagp argument */
  156. #define FOUND_MAILBOX    0x0001        /* found user@host address form */
  157.